"""
强制类型转换
1. int() 参数可以是整数，浮点数，字符串

2. float() 参数是整数，浮点数，字符串

3. str() 参数是整数，浮点数，字符串
"""

def testCasting():
    # 整数转换
    print("int(2) is {}".format(int(2)))
    print("int(12.3243) is {}".format(int(12.3243)))
    print("int('123') is {}".format(int("123")))

    # 浮点转换
    print("float(12) is {}".format(float(12)))
    print("float(12.32) is {}".format(float(12.32)))
    print("float('12.2') is {}".format('12.2'))

    # str转换
    print("str(12) is {}".format(str(12)))
    print("str(12.32) is {}".format(str(12.32)))
    print("str('213d') is {}".format(str('213d')))

testCasting()